# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=crackq
pkgver=48.89b7318
pkgrel=4
groups=('blackarch' 'blackarch-cracker')
pkgdesc='Hashcrack.org GPU-accelerated password cracker.'
arch=('any')
url='https://github.com/vnik5287/Crackq'
license=('custom:unknown')
makedepends=('git')
depends=('python2' 'python2-simplejson')
source=("$pkgname::git+https://github.com/vnik5287/Crackq.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  rm README.md

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/crackqcli" << EOF
#!/bin/sh
exec python2 /usr/share/$pkgname/crackqcli.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/crackqcli"
}

